package org.particles.domain;

/**
 * exponential implementation of one parameter function.
 * the closer distance the exponential greater is the value,
 * but maximal maxFieldStrength.
 */
public class ExpFunction extends AbstractFunction {

	public ExpFunction(final double maxFieldStrength) {
		setFactor(maxFieldStrength);
	}
	
	@Override
	public double calc(final double distance) {
		return calc(distance, getFactor());
	}
	
	@Override
	public double calc(final double distance, final double factor) {
		return factor / Math.pow((distance + 1), 2);
	}

}
